<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增【添加订单】')" />
    <script type=“text/javascript” src="../../../js/jquery.min.js"></script>
    <mata http-equiv="Content-Type" content="application/json; charset=utf-8"></mata>
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-Information-add">
            <div class="form-group">
                <label class="col-sm-3 control-label">寄件人数据：</label>
                <div class="col-sm-8">
                    <textarea id="sendText" name="sendText" class="form-control"></textarea>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">寄件省：</label>
                <div class="col-sm-8">
                    <input id="sendProvince" name="sendProvince" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">寄件市：</label>
                <div class="col-sm-8">
                    <input id="sendCity" name="sendCity" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">寄件区：</label>
                <div class="col-sm-8">
                    <input id="sendCounty" name="sendCounty" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">寄件街道：</label>
                <div class="col-sm-8">
                    <input id="sendTown" name="sendTown" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">寄件姓名：</label>
                <div class="col-sm-8">
                    <input id="sendPerson" name="sendPerson" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">寄件详细地址：</label>
                <div class="col-sm-8">
                    <input id="sendDetail" name="sendDetail" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">寄件电话号码：</label>
                <div class="col-sm-8">
                    <input id="sendPhonenum" name="sendPhonenum" class="form-control" type="text">
                </div>
            </div>


            <input align="center" type="button" class="btn btn-success btn-xs" value="解析" onclick="sendParse()" />


            <div class="form-group">    
                <label class="col-sm-3 control-label">收件人数据：</label>
                <div class="col-sm-8">
                    <textarea id="receiveText" name="receiveText" class="form-control" type="text"></textarea>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">收件省：</label>
                <div class="col-sm-8">
                    <input id="receiveProvince" name="receiveProvince" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">收件市：</label>
                <div class="col-sm-8">
                    <input id="receiveCity" name="receiveCity" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">收件区：</label>
                <div class="col-sm-8">
                    <input id="receiveCounty" name="receiveCounty" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">收件街道：</label>
                <div class="col-sm-8">
                    <input id="receiveTown" name="receiveTown" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">收件姓名：</label>
                <div class="col-sm-8">
                    <input id="receivePerson" name="receivePerson" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">收件详细地址：</label>
                <div class="col-sm-8">
                    <input id="receiveDetail" name="receiveDetail" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">收件电话号码：</label>
                <div class="col-sm-8">
                    <input id="receivePhonenum" name="receivePhonenum" class="form-control" type="text">
                </div>
            </div>
            <input align="center" type="button" class="btn btn-success btn-xs" value="解析" onclick="receiveParse()" />
        </form>

    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "system/Information"
        $("#form-Information-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-Information-add').serialize());
            }
        }

        function sendParse(){
            sendText = $("#sendText").val()
            console.log(sendText)
            $.ajax({
                type:'POST',
                url:'/system/Information/getData',
                dataType:'json',
                data: { text:sendText},
                success:function (data){
                    $('#sendProvince').val(data.province)
                    $('#sendCity').val(data.city)
                    $('#sendCounty').val(data.county)
                    $('#sendTown').val(data.town)
                    $('#sendPerson').val(data.person)
                    $('#sendDetail').val(data.detail)
                    $('#sendPhonenum').val(data.phonenum)
                    console.log(data)
                },
                error:function (error){
                    console.log(error)
                }
            })
        }
        function receiveParse(){
            receiveText = $("#receiveText").val()
            console.log(sendText)
            $.ajax({
                type:'POST',
                url:'/system/Information/getData',
                dataType:'json',
                data: { text:receiveText},
                success:function (data){
                    $('#receiveProvince').val(data.province)
                    $('#receiveCity').val(data.city)
                    $('#receiveCounty').val(data.county)
                    $('#receiveTown').val(data.town)
                    $('#receivePerson').val(data.person)
                    $('#receiveDetail').val(data.detail)
                    $('#receivePhonenum').val(data.phonenum)
                    console.log(data)
                },
                error:function (error){
                    console.log(error)
                }
            })
        }
    </script>
</body>
</html>